//
//  HQYQuestionnaireCell.m
//  HONGQIYUN
//
//  Created by leihuiwu on 16/12/23.
//  Copyright © 2016年 Haidi. All rights reserved.
//

#import "HQYQuestionnaireCell.h"

@interface HQYQuestionnaireCell ()

@property (nonatomic, strong) UIImageView *bgImageView;

@property (nonatomic, strong) UILabel *titleLabel;

@property (nonatomic, strong) UILabel *descLablel;

@end

@implementation HQYQuestionnaireCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if(self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self viewLayout];
    }
    return self;
}

- (void)viewLayout {
    
    [self addSubview:self.bgImageView];
    [self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left);
        make.right.equalTo(self.mas_right);
        make.top.equalTo(self.mas_top);
        make.bottom.equalTo(self.mas_bottom);
    }];
    
    
    [self addSubview:self.titleLabel];
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left);
        make.right.equalTo(self.mas_right);
        make.height.equalTo(@(ceil(2 * self.titleLabel.font.lineHeight)));
        make.top.equalTo(self.mas_top).offset(50);
    }];
    
    
    [self addSubview:self.descLablel];
    [self.descLablel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left);
        make.right.equalTo(self.mas_right);
        make.height.equalTo(@(ceil(self.descLablel.font.lineHeight)));
        make.bottom.equalTo(self.mas_bottom).offset(-50);
    }];
    
    self.titleLabel.text = @"test1";
    
    self.descLablel.text = @"sdfjskldfjklsdjfklds";
    
    self.bgImageView.image = [UIImage imageNamed:@"bg_huaqian"];
}

#pragma mark - lazy load
- (UIImageView *)bgImageView {
    if(!_bgImageView) {
        _bgImageView = [[UIImageView alloc]init];
    }
    return _bgImageView;
}

- (UILabel *)titleLabel {
    if(!_titleLabel) {
        _titleLabel = [[UILabel alloc]init];
        _titleLabel.font = [UIFont boldSystemFontOfSize:17];
        _titleLabel.textColor = [UIColor whiteColor];
        _titleLabel.textAlignment = NSTextAlignmentCenter;
    }
    return _titleLabel;
}

- (UILabel *)descLablel {
    if(!_descLablel) {
        _descLablel = [[UILabel alloc]init];
        _descLablel.font = [UIFont systemFontOfSize:15];
        _descLablel.textColor = [UIColor whiteColor];
        _descLablel.textAlignment = NSTextAlignmentCenter;
    }
    return _descLablel;
}


@end
